3.988 \(\int \frac{(1-a x)^{-n} (1+a x)^n}{x} \, dx\)

Optimal. Leaf size=86 \[ \frac{(1-a x)^{-n} (a x+1)^n \, _2F_1\left (1,-n;1-n;\frac{1-a x}{a x+1}\right )}{n}-\frac{2^n (1-a x)^{-n} \, _2F_1\left (-n,-n;1-n;\frac{1}{2} (1-a x)\right )}{n} \]

[Out]

((1 + a*x)^n*Hypergeometric2F1[1, -n, 1 - n, (1 - a*x)/(1 + a*x)])/(n*(1 - a*x)^
n) - (2^n*Hypergeometric2F1[-n, -n, 1 - n, (1 - a*x)/2])/(n*(1 - a*x)^n)

_______________________________________________________________________________________

Rubi [A]  time = 0.107359, antiderivative size = 86, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143 \[ \frac{(1-a x)^{-n} (a x+1)^n \, _2F_1\left (1,-n;1-n;\frac{1-a x}{a x+1}\right )}{n}-\frac{2^n (1-a x)^{-n} \, _2F_1\left (-n,-n;1-n;\frac{1}{2} (1-a x)\right )}{n} \]

Antiderivative was successfully verified.

[In]  Int[(1 + a*x)^n/(x*(1 - a*x)^n),x]

[Out]

((1 + a*x)^n*Hypergeometric2F1[1, -n, 1 - n, (1 - a*x)/(1 + a*x)])/(n*(1 - a*x)^
n) - (2^n*Hypergeometric2F1[-n, -n, 1 - n, (1 - a*x)/2])/(n*(1 - a*x)^n)

_______________________________________________________________________________________

Rubi in Sympy [A]  time = 12.6793, size = 70, normalized size = 0.81 \[ - \frac{2^{n - 1} \left (- a x + 1\right )^{- n + 1}{{}_{2}F_{1}\left (\begin{matrix} - n + 1, - n + 1 \\ - n + 2 \end{matrix}\middle |{- \frac{a x}{2} + \frac{1}{2}} \right )}}{- n + 1} - \frac{\left (- a x + 1\right )^{- n + 1} \left (a x + 1\right )^{n - 1}{{}_{2}F_{1}\left (\begin{matrix} - n + 1, 1 \\ - n + 2 \end{matrix}\middle |{\frac{a x - 1}{- a x - 1}} \right )}}{- n + 1} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  rubi_integrate((a*x+1)**n/x/((-a*x+1)**n),x)

[Out]

-2**(n - 1)*(-a*x + 1)**(-n + 1)*hyper((-n + 1, -n + 1), (-n + 2,), -a*x/2 + 1/2
)/(-n + 1) - (-a*x + 1)**(-n + 1)*(a*x + 1)**(n - 1)*hyper((-n + 1, 1), (-n + 2,
), (a*x - 1)/(-a*x - 1))/(-n + 1)

_______________________________________________________________________________________

Mathematica [C]  time = 0.353238, size = 182, normalized size = 2.12 \[ \frac{2 (n-2) (1-a x)^{1-n} (a x+1)^n F_1\left (1-n;-n,1;2-n;\frac{1}{2} (1-a x),1-a x\right )}{a (1-n) x \left ((a x-1) \left (n F_1\left (2-n;1-n,1;3-n;\frac{1}{2} (1-a x),1-a x\right )-2 F_1\left (2-n;-n,2;3-n;\frac{1}{2} (1-a x),1-a x\right )\right )-2 (n-2) F_1\left (1-n;-n,1;2-n;\frac{1}{2} (1-a x),1-a x\right )\right )} \]

Warning: Unable to verify antiderivative.

[In]  Integrate[(1 + a*x)^n/(x*(1 - a*x)^n),x]

[Out]

(2*(-2 + n)*(1 - a*x)^(1 - n)*(1 + a*x)^n*AppellF1[1 - n, -n, 1, 2 - n, (1 - a*x
)/2, 1 - a*x])/(a*(1 - n)*x*(-2*(-2 + n)*AppellF1[1 - n, -n, 1, 2 - n, (1 - a*x)
/2, 1 - a*x] + (-1 + a*x)*(n*AppellF1[2 - n, 1 - n, 1, 3 - n, (1 - a*x)/2, 1 - a
*x] - 2*AppellF1[2 - n, -n, 2, 3 - n, (1 - a*x)/2, 1 - a*x])))

_______________________________________________________________________________________

Maple [F]  time = 0.072, size = 0, normalized size = 0. \[ \int{\frac{ \left ( ax+1 \right ) ^{n}}{x \left ( -ax+1 \right ) ^{n}}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  int((a*x+1)^n/x/((-a*x+1)^n),x)

[Out]

int((a*x+1)^n/x/((-a*x+1)^n),x)

_______________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \[ \int \frac{{\left (a x + 1\right )}^{n}{\left (-a x + 1\right )}^{-n}}{x}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((a*x + 1)^n/((-a*x + 1)^n*x),x, algorithm="maxima")

[Out]

integrate((a*x + 1)^n*(-a*x + 1)^(-n)/x, x)

_______________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \[{\rm integral}\left (\frac{{\left (a x + 1\right )}^{n}}{{\left (-a x + 1\right )}^{n} x}, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((a*x + 1)^n/((-a*x + 1)^n*x),x, algorithm="fricas")

[Out]

integral((a*x + 1)^n/((-a*x + 1)^n*x), x)

_______________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \[ \text{Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((a*x+1)**n/x/((-a*x+1)**n),x)

[Out]

Timed out

_______________________________________________________________________________________

GIAC/XCAS [F]  time = 0., size = 0, normalized size = 0. \[ \int \frac{{\left (a x + 1\right )}^{n}}{{\left (-a x + 1\right )}^{n} x}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]  integrate((a*x + 1)^n/((-a*x + 1)^n*x),x, algorithm="giac")

[Out]

integrate((a*x + 1)^n/((-a*x + 1)^n*x), x)